#define _CRT_SECURE_NO_WARNINGS 1
#pragma warning(disable:6031)
#include <iostream>
#include <string>
#include <string>
using namespace std;

int main() {

    // write your code here......
    string s1;
    long int x = 9;
    while (x <= 9999999999)
    {
        s1.push_back((char)x);
        x = x * 10 + 9;
    }
    int sum = 0;
    for (auto it : s1)
    {
        sum += (int)it;
    }
    cout << sum << endl;
    return 0;
}